home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: uu4news.netcom.com!friend!news
- From: rich@kastle.com (Richard Krehbiel)
- Subject: Re: Watch out! C "gotcha!"
- Message-ID: <1996Feb15.124111.8122@friend.kastle.com>
- Sender: news@friend.kastle.com (News)
- Reply-To: rich@kastle.com
- Organization: Kastle Development Associates
- X-Newsreader: Forte Free Agent 1.0.82
- References: <4fthhh$7th@blackice.winternet.com>
- Date: Thu, 15 Feb 1996 12:41:58 GMT
-
- mschwarz@winternet.com (Michael Schwarz) wrote:
-
- >Many of you may already know this, but even after ten years of coding
- >in C, this took my by surprise at first. A co-worker and I were looking
- >at some library C code where I work and we noticed that the "default"
- >clause of one of the switches was misspelled as "defalt."
-
- Yep. I've done that.
-
- I recently encountered the following bug:
-
- enum opcode code;
-
- switch(code)
- {
- case OC_STAT:
- ...
- break;
- case OC_RECID:
- ...
- break;
- OC_SUP: /* Oh, look - I forgot to type 'case'. :-( */
- ...
- break;
- case OC_IND:
- ...
- break;
- }
-
- This code has been compiling and working well until a recent revision
- to the data generator started producing OC_SUP.
-
- --
- Richard Krehbiel, Kastle Systems, Arlington VA USA
- rich@kastle.com (work) or richk@mnsinc.com (personal)
-
-